<style lang="less">
</style>
<template>
  <div class="login">
    <Input v-model="registerNum" style="width: 200px" placeholder="请输入注册数量"></Input>
    <Button @click="btnAddClick">新增</Button>
    <Table
      border highlight-row
      :columns="columns" :data="tableData"></Table>

  </div>
</template>
<script>
import { addCode } from '@/api/verifycode'

export default {
  components: {
  },
  data () {
    return {
      registerNum: '',
      tableData: [],
      columns: [{
        type: 'index',
        width: 60,
        align: 'center'
      }, {
        title: '验证码',
        key: 'code'
      }]
    }
  },
  methods: {
    btnAddClick () {
      let res = []
      for (var i = 0; i < this.registerNum; i++) {
        let code = (new Date()).valueOf()
        // eslint-disable-next-line no-unused-vars
        let param = {
          groupid: localStorage.groupid, code
        }
        addCode(param).then(res => {
          console.log(res)
        })
        res.push({code})
        this.tableData = res
      }
    }
  }
}

</script>
<style>
</style>
